<template>
	<el-dialog :title="dialogTitle" :visible.sync="visible" top="0" width="560px" append-to-body>
		<el-form v-bind="formConfig" :model="formData" :rules="formRules" label-width="80px" v-loading="loading">
			<el-row :gutter="16">
				<el-col :span="24">
					<el-form-item label="链接名称" prop="linkName">
						<el-input v-model="formData.linkName" placeholder="请输入链接名称"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="链接地址" prop="linkHref">
						<el-input v-model="formData.linkHref" placeholder="请输入链接名称"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="排序" prop="orderBy">
						<el-input-number v-model="formData.orderBy" controls-position="right" :min="1"></el-input-number>
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>
		<template slot="footer">
			<el-button size="medium" @click="visible = false">取消</el-button>
			<el-button size="medium" type="primary" :loading="btnLoading" @click="handleSubmitForm()">{{ formTypeName }}</el-button>
		</template>
	</el-dialog>
</template>

<script>
import formMixins from '@/mixins/formMixins';
import { queryAddress, addAddress, updateAddress } from '@/api/basedata/tbSysAddress';
export default {
	mixins: [formMixins],
	data() {
		return {
			formName: '友情链接',
			formRules: {
				linkName: [{ required: true, message: '请输入友情链接名称', trigger: 'blur' }],
				linkHref: [{ required: true, message: '请输入友情链接地址', trigger: 'blur' }]
			}
		};
	},
	computed: {
		detailData() {
			return eval(queryAddress);
		},
		callFunction() {
			return eval(this.addOrEdit ? addAddress : updateAddress);
		}
	}
};
</script>
